package model

import (
	"360-cinema/user-server/basic/config"
	"gorm.io/gorm"
)

type Video struct {
	gorm.Model
	UserId      int    `gorm:"type:int(11);comment:用户ID"`
	Title       string `gorm:"type:varchar(30);comment:标题"`
	Description string `gorm:"type:varchar(100);comment:简介"`
	CoverUrl    string `gorm:"type:varchar(500);comment:视频封面"`
	FileUrl     string `gorm:"type:varchar(500);comment:视频文件"`
	Type        string `gorm:"type:varchar(30);comment:分类"`
	Address     string `gorm:"type:varchar(30);comment:地区"`
	Year        string `gorm:"type:varchar(30);comment:年份"`
	Play        int    `gorm:"type:int(11);comment:播放量"`
	Like        int    `gorm:"type:int(11);comment:点赞量"`
	Collect     int    `gorm:"type:int(11);comment:收藏量"`
	Comment     int    `gorm:"type:int(11);comment:评论量"`
	Status      string `gorm:"type:varchar(30);comment:审核状态"`
	Reject      string `gorm:"type:varchar(30);comment:驳回理由"`
	Actor       string `gorm:"type:varchar(30);comment:主演"`
	Director    string `gorm:"type:varchar(30);comment:导演"`
	Rd          int    `gorm:"type:int(11);comment:热度"`
}

func CreateVideo(v *Video) error {

	return config.DB.Create(&v).Error
}
func UpdateVideo(v *Video, id int) error {

	return config.DB.Where("id=?", id).Updates(&v).Error
}
